//
//  NetworkingProtocol.swift
//  weibo
//
//  Created by yellow on 15/10/17.
//  Copyright © 2015年 yellow. All rights reserved.
//

import Foundation

//定义枚举，需要指定枚举的类型(类型可以使任何类型)
enum HttpMethod:String{
    case GET = "GET"
    case POST = "POST"
}

//定义执行完网络操作后的闭包,并重定义
typealias FinishedBlock = ((result:AnyObject?, error:NSError?) -> (Void))?

/// 定义一组网络操作的协议
protocol NetworkingProtocol:NSObjectProtocol{
    
    ///普通的get和post请求
    func httpRequest(httpMethod:HttpMethod,URLString:String,parameter:AnyObject?,finished:FinishedBlock)
    
    /// 文件上传
    ///
    /// - parameter fileData:  文件
    /// - parameter name:      server的key
    func httpUpload(fileData:NSData,name:String,URLString:String,parameter:AnyObject?,finished:FinishedBlock)
}